<%+header%>
<%
	local running = luci.sys.exec("pgrep -x /usr/bin/dae-wing")
	local dashrunning = luci.sys.exec("[ -e '/tmp/log/daed-next/dashboard.pid' ] && echo '1' || echo 'x'")
%>
<% if tonumber(running) ~= nil and tonumber(dashrunning) ~= nil then %>
	<div class="cbi-map">
		<iframe id="daed-next" style="width: 100%; min-height: 780px; border: none; border-radius: .375rem;box-shadow: rgba(0, 0, 0, 0.75) 0px 0px 15px -5px;"></iframe>
	</div>
	<script type="text/javascript">
		var port = "<%=luci.sys.exec("uci -q get daed-next.config.listen_port"):gsub("^%s*(.-)%s*$", "%1")%>";
		document.getElementById("daed-next").src = window.location.protocol + "//" + window.location.hostname + ":" + port  + "/network";
		document.getElementById("daed-next").height = document.documentElement.clientHeight;
		window.onresize = function(){
			document.getElementById("daed-next").height = document.documentElement.clientHeight;
		}
	</script>
<% else %>
	<style>.notrunning{text-align: center;} h1{font-size: 25px; color: #333; margin-bottom: 16px;} p{font-size: 18px; color: #666; margin-bottom: 24px;}</style>
	<div class="notrunning">
		<img src="" height="90px" />
		<h1><font color="color:red"><%:dae-wing or dashboard is not running%></font></h1>
		<p><%:Please start the dae-wing service and the dashboard service first and try again%></p>
    </div>
<% end -%>

<%+footer%>